﻿using System;
using System.Collections.Generic;

namespace DotNetRepository
{
    public interface IEntityCollection<TEntity> : IEntityCollection, ICollection<TEntity>, IEntityEnumeration<TEntity>
        where TEntity : class, IEntity
    {
        bool Contains(Guid id);
        bool ContainsAny(IEnumerable<Guid> ids);
        bool ContainsAll(IEnumerable<Guid> ids);
        bool ContainsAny(IEnumerable<TEntity> item);
        bool ContainsAll(IEnumerable<TEntity> item);
        void Initialize(IEntity parentContainer);

        bool Remove(Guid id);
        event EntityAddedEventHandler<TEntity> EntityAddedEvent;
        event EntityRemovedEventHandler<TEntity> EntityRemovedEvent;
    }

    public interface IEntityCollection : IEntityEnumeration
    {
        void SubmitChanges();
        void RevertChanges();
        void ClearAndSubmit();
        bool Initialized {get;}
        void Initialize(object parentContainer);
    }

    public delegate void EntityAddedEventHandler<in TEntity>(TEntity entity) where TEntity : class, IEntity;

    public delegate void EntityRemovedEventHandler<in TEntity>(TEntity entity) where TEntity : class, IEntity;
}
